package com.ansion.utils.hash;

import android.util.Base64;

import androidx.annotation.NonNull;

public class Base64Helper {
    public static String encode(@NonNull byte[] data) {
        return Base64.encodeToString(data, Base64.NO_WRAP);
    }

    public static byte[] decode(@NonNull String data) {
        return Base64.decode(data,  Base64.DEFAULT);
    }

    public static String encodeUrlSafe(@NonNull byte[] data) {
        return Base64.encodeToString(data, Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING);
    }

    public static byte[] decodeUrlSafe(@NonNull String data) {
        return Base64.decode(data, Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING);
    }
}
